package cn.blackbirds.blocks;

import static com.wiyun.engine.utils.Utilities.randZeroToOne;

import java.util.List;

import cn.blackbirds.blocks.model.Block;

public class Utils {

	
	

	// 注：产生随机数的方法有待于改进，搞不好可能一直循环下去，虽然机率较低
	public static int makeRandom(int base) {
		int r;
		do {
			r = (int) (randZeroToOne() * 10);
		} while (r >= base);

		return r;
	}
	
	/**
	 * 获取分数
	 * @param list
	 * @return
	 */
	public static int getScoreThisTunr(List<Block> list){
		if(list.size() == Globals.CONTINUOUS_BLOCKS)
			return 100;
		else if(list.size() == (Globals.CONTINUOUS_BLOCKS + 1))
			return 150;
		else if(list.size() == (Globals.CONTINUOUS_BLOCKS + 2))
			return 200;
		else if(list.size() > (Globals.CONTINUOUS_BLOCKS + 2))
			return 250;
		else return 0;
	}

	
}
